package com.obor.quartz.job.controller;

import java.util.Arrays;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.zn.mvcbase.controller.ResponseMessageController;
import org.zn.mvcbase.response.ResponseMessage;
import org.zn.mvcbase.response.status.Success;

import com.obor.quartz.job.JobInfo;
import com.obor.quartz.job.service.JobInfoService;

/**
*
* @Company OBOR
* @Author 李志鹏
* @Description
* @Date 2019年4月25日
*
*/

@RestController
@RequestMapping("jobInfo")
public class JobInfoController extends ResponseMessageController {

	
	@Autowired
	private JobInfoService jobInfoSer;
	
	@GetMapping(value = "list")
	public ResponseMessage getListByParam(JobInfo bl) {
		jobInfoSer.list(getPaginationUtility(), bl);
		
		return getEasyUIDataGridMessage("OK");
	}
	
	@GetMapping(value = "one")
	public ResponseMessage getOne(String id) {
		
		return getDetailMessage(Success.MAINSUCCESS, jobInfoSer.one(id));
	}
	
	@PostMapping(value = "del")
	public ResponseMessage delJobInfo(String ids) {

		jobInfoSer.del(Arrays.asList(ids.split(",")));
		
		return getMainStatus(Success.UPDATASUCCESS);
	}
	
	@PostMapping(value = "save")
	public ResponseMessage addOmdify(JobInfo jobInfo) {
		jobInfoSer.add(jobInfo);
		
		return getDetailMessage(Success.MAINSUCCESS, jobInfo.getId());
	}
	
	
//	@PostMapping(value = "save1")
//	public void addOmdify1(aa a) {
//		
//		System.out.println(a.getMap().toString());
//	}
}
